using System;
using Castle.ActiveRecord;
namespace IronMis2.Models
{
    [ActiveRecord("commodity")]
    public class Commodity : ActiveRecordBase<Commodity>
    {
        private Guid id;
        private string comId;
        private string comName;
        private string comSpec;
        private string comType;
        private string comUnit;
        private string comBarCode;
        private Decimal comPrice;
        private long comStor;
        private string comRemark;
        private DateTime? comDate;
        private Provider provider;
        private Storehouse storhouse;

        [PrimaryKey(PrimaryKeyType.GuidComb,Column = "id")]
        public Guid Id
        {
            set { id = value; }
            get { return id; }
        }

        [BelongsTo(Column = "com_pro_id",ForeignKey = "id",Insert = true,Update = true,Fetch = FetchEnum.Select)]
        public Provider Provider
        {
            set { provider = value; }
            get { return provider; }
        }

        [BelongsTo(Column = "com_stor_id",ForeignKey = "id",Insert = true,Update = true,Fetch = FetchEnum.Select)]
        public Storehouse Storhouse
        {
            set { storhouse = value; }
            get { return storhouse; }
        }

        [Property(Column = "com_remark",SqlType = "varchar",Length = 50)]
        public string ComRemark
        {
            set { comRemark = value; }
            get { return comRemark; }
        }

        [Property(Column = "com_name",SqlType = "varchar",Length = 50)]
        public string ComName
        {
            set { comName = value; }
            get { return comName; }
        }

        [Property(Column = "com_id",SqlType = "char",Length = 10)]
        public string ComId
        {
            set { comId = value; }
            get { return comId; }
        }

        [Property(Column = "com_spec",SqlType = "char",Length = 20)]
        public string ComSpec
        {
            set { comSpec = value; }
            get { return comSpec; }
        }

        [Property(Column="com_type",SqlType = "char",Length = 20)]
        public string ComType
        {
            set { comType = value; }
            get { return comType; }
        }

        [Property(Column="com_units",SqlType = "char",Length = 10)]
        public string ComUnit
        {
            set { comUnit = value; }
            get { return comUnit; }
        }

        [Property(Column = "com_bar_code",SqlType = "char",Length = 20)]
        public string ComBarCode
        {
            set { comBarCode = value; }
            get { return comBarCode; }
        }

        [Property(Column="com_in_price",SqlType = "decimal",Length = 9)]
        public decimal ComPrice
        {
            set { comPrice = value; }
            get { return comPrice; }
        }

        [Property(Column = "com_storage",SqlType = "numeric",Length = 4)]
        public long ComStor
        {
            set { comStor = value; }
            get { return comStor; }
        }

        [Property(Column = "com_date",SqlType = "datetime",Length = 8)]
        public DateTime? Comdate
        {
            set { comDate = value; }
            get { return comDate; }
        }
    }
}
